//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_VGA_H__
#define __ELASTOS_VGA_H__

const physaddr_t c_paVGATextVideoMemoryPhysBase = 0xb8000;

enum {
    TextScreen_Columns          = 80,
    TextScreen_Rows             = 25,
};

enum {
    TextColor_Black             = 0x0,
    TextColor_Blue              = 0x1,
    TextColor_Green             = 0x2,
    TextColor_Aqua              = 0x3,
    TextColor_Red               = 0x4,
    TextColor_Purple            = 0x5,
    TextColor_Yellow            = 0x6,
    TextColor_White             = 0x7,
    TextColor_Gray              = 0x8,
    TextColor_LightBlue         = 0x9,
    TextColor_LightGreen        = 0xa,
    TextColor_LightAqua         = 0xb,
    TextColor_LightRed          = 0xc,
    TextColor_LightPurple       = 0xd,
    TextColor_LightYellow       = 0xe,
    TextColor_BrightWhite       = 0xf,
};

typedef uint16_t    textchar_t;

#define TEXT_COLOR(bgcolor, fgcolor)    (((bgcolor) << 4) + (fgcolor))
#define TEXT_CHAR(value, color)         ((textchar_t)(((color) << 8) + (value)))

// VGA ports
enum {
    VGAPort_AddressRegister         = 0x03d4,
    VGAPort_DataRegister            = 0x03d5,
};

// CRT Controller Registers' index
enum {
    VGARegIndex_CursorLocationHigh  = 0x0e,
    VGARegIndex_CursorLocationLow   = 0x0f,
};

#endif // __ELASTOS_VGA_H__
